import java.util.Scanner;

public class FactorialSum {
    public static void main(String[] args) {
        int sum = 0;
        int Factorial = 1;
        int i = 0;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要求阶乘和的值");
        int ret = scanner.nextInt();

        for(i = 1;i <=ret;i++){
            Factorial *= i;
            sum += Factorial;
        }
        System.out.println(sum);
    }
}
